<!-- 新闻动态 -->
<template>
  <div>
      <my-header></my-header>
      <div class="w_1000">
          <div class="content">
            <el-row>
                <el-col :span="4">
                    <my-leftnav :nav='nav' @updateData="toChildShow"></my-leftnav>
                </el-col>
                <el-col :span="20" class="rightcontent">
                    <my-rightlist v-show="true"></my-rightlist>
                    <my-rightcontent v-show="false"></my-rightcontent>
                </el-col>
            </el-row>
          </div>
          
      </div>
  </div>
</template>

<script>
//引入组建
import Header from "@/components/Header";
import LeftNav from "@/components/content/LeftNav";
import RightList from "@/components/content/RightList";
import RightContent from "@/components/content/RightContent";

//数据处理
function checkData(id){
  console.log(id);
}

export default {
  data() {
    return {
        nav:{
            title:'新闻动态',
            data:[
                {
                    id:'notice',
                    title:'通知公告',
                    active:true
                },
                {
                    id:'news',
                    title:'热点新闻',
                    active:false
                }
            ]
        },
    };
  },
  methods:{
      toChildShow(id){
          let res=this.nav.data
          for(let i=0;i<res.length;i++){
              if(res[i].id==id){
                  res[i].active=true;
              }
              else{
                  res[i].active=false;
              }
          }
          
          this.nav.data=res;
      }
  },
  /** 组件注册 */
  components: {
    "my-header": Header,
    "my-leftnav":LeftNav,
    "my-rightlist":RightList,
    "my-rightcontent":RightContent
  }
};
</script>
<style scoped>
.rightcontent{
    border-left: 1px solid #eee;
}
</style>